import React from 'react'
import ProForm, { ProFormGroup, ProFormTextArea } from '@ant-design/pro-form'
import EditorDemo from '@/components/Editor'

function Radio (props) {
  const { setDetails, typeQuestion, questionDetails } = props

  return (
    <>
      {/* 正确答案 */}
      <ProFormTextArea
        label="正确答案"
        required
        name="success_answer"
        initialValue={
          (typeQuestion === 'fill' && questionDetails.content === undefined)
            ? '3[美猴王, 齐天大圣, 弼马温]'
            : (questionDetails.content !== undefined) ? questionDetails.content : ''
        }
      />

      {/* 答案解析 */}
      <ProFormGroup>
        <ProForm.Item
          label="答案解析"
          required name="analysis"
          initialValue={questionDetails.analysis === undefined ? '' : questionDetails.analysis}
        >
          <EditorDemo
            setDetails={setDetails}
            name="analysis"
            content={questionDetails.analysis === undefined ? '' : questionDetails.analysis}
          />
        </ProForm.Item>
      </ProFormGroup>
    </>
  )
}

export default Radio
